import java.io.IOException;

class Main implements Runnable {
    static String ReadLn(int maxLength) {
        byte line[] = new byte[maxLength];
        int length = 0;
        int input = -1;
        try {
            while (length < maxLength) {
                input = System.in.read();
                if ((input < 0) || (input == '\n'))
                    break;
                line[length++] += input;
            }

            if ((input < 0) && (length == 0))
                return null;
            return new String(line, 0, length);
        } catch (IOException e) {
            return null;
        }
    }

    public static void main(String args[]) {
        Main myWork = new Main();
        myWork.run();
    }

    public void run() {
        new myStuff().run();
    }
}

class myStuff implements Runnable {
    private static final int MAX_LENGTH = 1024;

    public void run() {
        String line;
        while ((line = Main.ReadLn(MAX_LENGTH)) != null) {
            line = line.trim();
            if (line.isEmpty()) {
                continue;
            }
            int numberOfStudents = Integer.valueOf(line);
            if (numberOfStudents == 0) {
                while (Main.ReadLn(MAX_LENGTH) != null)
                    ; // Flush the remaining lines
                break;
            }
            int resultInCents = solve(numberOfStudents);
            int dollarPart = resultInCents / 100;
            int centPart = resultInCents % 100;
            System.out.println("$" + dollarPart + "."
                    + (centPart < 10 ? "0" + centPart : centPart));
        }
    }

    public int solve(int numberOfStudents) {
        int totalExpenseInCents = 0;
        int[] expensesInCents = new int[numberOfStudents];
        for (int i = 0; i < numberOfStudents; i++) {
            String line = Main.ReadLn(MAX_LENGTH);
            line = line.trim();
            expensesInCents[i] = (int) (Math.round(Float.valueOf(line) * 100));
            totalExpenseInCents += expensesInCents[i];
        }
        int averageExpenseInCents = (int) Math
                .round(((double) totalExpenseInCents) / numberOfStudents);
        int upperDeviationSumInCents = 0;
        int lowerDeviationSumInCents = 0;
        for (int i = 0; i < numberOfStudents; i++) {
            if (expensesInCents[i] < averageExpenseInCents) {
                lowerDeviationSumInCents += averageExpenseInCents
                        - expensesInCents[i];
            } else {
                upperDeviationSumInCents += expensesInCents[i]
                        - averageExpenseInCents;
            }
        }
        return lowerDeviationSumInCents < upperDeviationSumInCents ? lowerDeviationSumInCents
                : upperDeviationSumInCents;
    }
}
